package top.lvkun.quartz.job;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * 工作任务
 *  要求必须是Job接口的实现类，重写execute方法
 * @author Administrator
 * @version 1.0
 * @date 2021/1/24 11:06
 */
public class PrintJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("嘿嘿嘿，居然执行了.........." + System.currentTimeMillis());
        //获取传递过来的参数
        JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
        String username = jobDataMap.getString("username");
        System.out.println(username);
    }
}
